package com.sphd.beautysalon.presenter;


import com.android.volley.VolleyError;
import com.sphd.beautysalon.info.RestaurantInfo;
import com.sphd.beautysalon.model.SupperMeangerModelImpl;
import com.sphd.beautysalon.view.SupperMeangerView;

import java.util.List;

/**
* Created by Hu on 2016/10/31
*/

public class SupperMeangerPresenterImpl implements SupperMeangerPresenter {
    SupperMeangerView supperMeangerView;
    SupperMeangerModelImpl supperMeangerModel;
    public SupperMeangerPresenterImpl(SupperMeangerView supperMeangerView) {
        this.supperMeangerView = supperMeangerView;
        supperMeangerModel=new SupperMeangerModelImpl();
    }

    @Override
    public void addData(String url) {
        supperMeangerView.showLoading();
        supperMeangerModel.sendUrl(url,this);
    }

    @Override
    public void sendError(VolleyError error) {
        supperMeangerView.dissLoading();
    }

    @Override
    public void sendRes(double all, double month, double today, List<RestaurantInfo> restaurantInfos) {
        supperMeangerView.setAll(all);
        supperMeangerView.setMonth(month);
        supperMeangerView.setToday(today);
        supperMeangerView.setResList(restaurantInfos);
        supperMeangerView.dissLoading();
    }
}